package com.yosaa.back.enums;

public enum MaleSitReachScore {
    EXCELLENT_100(100, 24.9f, 25.1f),
    EXCELLENT_95(95, 23.1f, 23.3f),
    EXCELLENT_90(90, 21.3f, 21.5f),
    GOOD_85(85, 19.5f, 19.9f),
    GOOD_80(80, 17.7f, 18.2f),
    PASS_78(78, 16.3f, 16.8f),
    PASS_76(76, 14.9f, 15.4f),
    PASS_74(74, 13.5f, 14.0f),
    PASS_72(72, 12.1f, 12.6f),
    PASS_70(70, 10.7f, 11.2f),
    PASS_68(68, 9.3f, 9.8f),
    PASS_66(66, 7.9f, 8.4f),
    PASS_64(64, 6.5f, 7.0f),
    PASS_62(62, 5.1f, 5.6f),
    PASS_60(60, 3.7f, 4.2f),
    FAIL_50(50, 2.7f, 3.2f),
    FAIL_40(40, 1.7f, 2.2f),
    FAIL_30(30, 0.7f, 1.2f),
    FAIL_20(20, -0.3f, 0.2f),
    FAIL_10(10, -1.3f, -0.8f);

    private final float score;
    private final float freshmanSophomore; // 大一大二标准
    private final float juniorSenior; // 大三大四标准

    MaleSitReachScore(float score, float freshmanSophomore, float juniorSenior) {
        this.score = score;
        this.freshmanSophomore = freshmanSophomore;
        this.juniorSenior = juniorSenior;
    }

    public float getScore() {
        return score;
    }

    public float getFreshmanSophomore() {
        return freshmanSophomore;
    }

    public float getJuniorSenior() {
        return juniorSenior;
    }

    // 根据成绩和年级计算分数
    public static float calculateScore(float distance, String grade) {
        for (MaleSitReachScore standard : MaleSitReachScore.values()) {
            float threshold = grade.equals("大一") || grade.equals("大二")
                    ? standard.getFreshmanSophomore()
                    : standard.getJuniorSenior();
            if (distance >= threshold) {
                return standard.getScore();
            }
        }
        return 0; // 默认分数
    }
}